<div id="role-body">

    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">操作</label>
            <div class="layui-input-block">
                <button type="button" onclick="SetPopup('添加角色','AddRole')"
                    class="layui-btn layui-btn-normal">添加角色</button>
            </div>
        </div>
    </form>
</div>
<script type="text/html" id="roleActtion">
    <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-xs" lay-event="edit">权限</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script>
    renderTable({
        elem: "#role-body",
        model: "roles",
        pk: "role_id",
        tableApi: api.role.get,
        updateApi: api.role.edit,
        delApi: api.role.del,
        cols: [
            { field: 'role_id', title: '编号', width: 80, sort: true, fixed: 'left' }
            , { field: 'role_name', title: '角色名称', edit: 'text', width: 100 }
            , { field: 'role_info', title: '简介', edit: 'text', sort: true }
            , { field: 'role_add_time', title: '时间', width: 150, sort: true }
            , { fixed: 'right', width: 165, align: 'center', toolbar: '#roleActtion' }
        ],
        editFunction: function (obj) {
            var data = obj.data;
            updateQueryStringParameter('role_id', data.role_id);
            SetPopup('权限设置', 'RolesSetting', { area: '1200px', offset: 't', scrollbar: false });

        }
    });
</script>